package com.orphan.audit.controller;


import com.orphan.audit.po.UserDetail;
import com.orphan.audit.service.IUserDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yichen
 * @since 2021-07-14
 */
@RestController
@RequestMapping("/detail")
public class UserDetailController {
    @Autowired
    public IUserDetailService iUserDetailService;
    @GetMapping("/gatAll")
    private List<UserDetail> getAll(){
        List<UserDetail> userDetails = iUserDetailService.getAll();
        return userDetails;
    }

    @GetMapping("/update/{uId}/{status}")
    public boolean update(@PathVariable("uId") Integer uId,@PathVariable("status")String status){
        UserDetail userDetail = new UserDetail();
        userDetail.setUId(uId);
        userDetail.setStatus(status);
        System.out.println("userDetail = " + userDetail);
        boolean update = iUserDetailService.update(userDetail);
        return update;
    }

}
